import pandas as pd

data = pd.read_csv('./ratings.csv')
print(len(data))
#划分训练集和测试集
train = data.sample(frac=0.8, random_state=9, axis=0)
test = data[~data.index.isin(train.index)]

print(len(train))
print(len(test))
train.to_csv('./u1.train', index=None, header=None)
test.to_csv('./u1.test', index=None, header=None)